#pragma once
#include <string>
#include <functional>
#include <memory>
#include <time.h>
#include "rtbus/rtbus.h"
namespace rtbus {
class SimBus : public RtCommuItf
{
public:
    SimBus() {}
    int open(uint8_t chn_id) { return 0; }
    int open(BusCfg cfg) { return 0; }
    void close() { return; }
    int active()
    {
        actived_ = true;
        return 0;
    }
    int deactive()
    {
        actived_ = false;
        return 0;
    }

    int register_sdo_handle(uint8_t slave_id, uint32_t write_req_frame_id, uint32_t read_req_frame_id, uint32_t resp_frame_id, size_t obj_id_size = 2)
    {
        return 0;
    }

    void send() { return; }
    void recv(int64_t* timeoff) { return; }
    void reset() { return; }
    bool is_actived() { return actived_; }

    int get_sdo(uint8_t slave_id, uint32_t obj_id, std::function<int(uint8_t*, int)> cb, int timeout = 80, int retry = 3)
    {
        uint8_t data[4] = {0};
        cb(data, 4);
        return 0;
    }

    int set_sdo(uint8_t slave_id, uint32_t obj_id, uint8_t val[4], size_t size, std::function<int(uint8_t*, int)> cb, int timeout = 80, int retry = 3)
    {
        cb(val, size);
        return 0;
    }

    int get_sdo_blocking(uint8_t slave_id, uint32_t objid, void* data, int data_len, int retry) { return 0; }
    bool actived_;
};
}  // namespace rtbus
